package com.shan;

import java.util.Random;
import java.util.Scanner;

/**
 * @Author: ShanYuqing
 * @Version: v1.0
 */
public class RandomTest {
    public static void main(String[] args) {
        random();
    }

    public static void random() {
        Random r = new Random();
        int randomNumber = r.nextInt(100) + 1;
        Scanner sc = new Scanner(System.in);
        while (true) {
            System.out.println("请输入您的数字：");
            int scNumber = sc.nextInt();
            if (scNumber < randomNumber) {
                System.out.println("猜小了！");
            } else if (scNumber > randomNumber) {
                System.out.println("猜大了！");
            } else {
                System.out.println("恭喜您答对了欧！");
                break ;
            }
        }
    }
}
